Try to load the JdbcTemplate class. It should fail.


In [1]:
try {
    Class.forName("org.springframework.jdbc.core.JdbcTemplate");
} catch (ClassNotFoundException ex) {
    println ex
}


java.lang.ClassNotFoundException: org.springframework.jdbc.core.JdbcTemplate
Out[1]:
No Outputs

Now, grab the related artifact with the grab mechanism.


In [2]:
#@dependency(group="org.springframework", module="spring-orm", version="3.2.5.RELEASE")


Resolving dependency: org.springframework#spring-orm;3.2.5.RELEASE {default=[default]}
Preparing to download artifact org.springframework#spring-orm;3.2.5.RELEASE!spring-orm.jar
Preparing to download artifact aopalliance#aopalliance;1.0!aopalliance.jar
Preparing to download artifact org.springframework#spring-beans;3.2.5.RELEASE!spring-beans.jar
Preparing to download artifact org.springframework#spring-core;3.2.5.RELEASE!spring-core.jar
Preparing to download artifact org.springframework#spring-jdbc;3.2.5.RELEASE!spring-jdbc.jar
Preparing to download artifact org.springframework#spring-tx;3.2.5.RELEASE!spring-tx.jar
Preparing to download artifact commons-logging#commons-logging;1.1.1!commons-logging.jar
Downloaded 2518 Kbytes in 3543ms:
  [SUCCESSFUL ] org.springframework#spring-orm;3.2.5.RELEASE!spring-orm.jar (614ms)
  [SUCCESSFUL ] aopalliance#aopalliance;1.0!aopalliance.jar (2ms)
  [SUCCESSFUL ] org.springframework#spring-beans;3.2.5.RELEASE!spring-beans.jar (1474ms)
  [SUCCESSFUL ] org.springframework#spring-core;3.2.5.RELEASE!spring-core.jar (494ms)
  [SUCCESSFUL ] commons-logging#commons-logging;1.1.1!commons-logging.jar (4ms)
  [SUCCESSFUL ] org.springframework#spring-jdbc;3.2.5.RELEASE!spring-jdbc.jar (469ms)
  [SUCCESSFUL ] org.springframework#spring-tx;3.2.5.RELEASE!spring-tx.jar (462ms)
Out[2]:
No Outputs

You can now load the JdbcTemplate class.


In [3]:
import org.springframework.jdbc.core.JdbcTemplate
obj = new JdbcTemplate();
obj


Out[3]:
org​.springframework​.jdbc​.core​.JdbcTemplate​@451711ac